/**
 * Definition for singly-linked list.
 * type ListNode struct {
 *     Val int
 *     Next *ListNode
 * }
 */
func merge(l1 *ListNode, l2 *ListNode) *ListNode {
    b1, b2 := l1, l2
    var arr []int = make([]int, 0)
    for {
        if b1 == nil {
            break
        } else {
            arr = append(arr, b1.Val)
            b1 = b1.Next
        }
    }
    for {
        if b2 == nil {
            break
        } else {
            arr = append(arr, b2.Val)
            b2 = b2.Next
        }
    }
    if len(arr) == 0 {
        return nil
    }
    for i:=0; i<len(arr)-1; i++ {
        for j:=i+1; j<len(arr); j++ {
            if arr[i] > arr[j] {
                arr[i], arr[j] = arr[j], arr[i]
            }
        }
    }
    
    var list []ListNode = make([]ListNode, 0)
    for i:=0; i < len(arr); i++ {
        var node ListNode
        node.Val = arr[i]
        node.Next = &node
        list = append(list, node)
    }
    
    for i:=0; i < len(arr); i++ {
        if i == len(arr)-1 {
            list[i].Next = nil
        } else {
            list[i].Next = &list[i+1]
        }
    }
    return &list[0]
}